{# **
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * #}

<div class="card" data-role="products-card">
  <h3 class="card-header">
    {{ 'Products'|trans({}, 'Admin.Global') }}
    ({{ viewableSupplier.supplierProducts|length }})
  </h3>
  <div class="card-body">
    {% for product in viewableSupplier.supplierProducts %}
      <div class="card">
        <div class="card-header clearfix">
          <a href="{{ path('admin_products_edit', {productId: product.id}) }}">{{ product.name }}</a>
        </div>
        <div class="card-body">
          <table class="table">
            <thead>
              <tr>
                <th>{{ 'Attribute name'|trans({}, 'Admin.Catalog.Feature') }}</th>
                <th>{{ 'Supplier reference'|trans({}, 'Admin.Catalog.Feature') }}</th>
                <th>{{ 'Wholesale price'|trans({}, 'Admin.Catalog.Feature') }}</th>
                <th>{{ 'Reference'|trans({}, 'Admin.Global') }}</th>
                <th>{{ 'EAN-13'|trans({}, 'Admin.Catalog.Feature') }}</th>
                <th>{{ 'UPC'|trans({}, 'Admin.Catalog.Feature') }}</th>
                {% if not isAllShopContext and isStockManagementEnabled %}
                  <th>{{ 'Available quantity'|trans({}, 'Admin.Catalog.Feature') }}</th>
                {% endif %}
              </tr>
            </thead>
            <tbody>
            {% if product.combinations is not empty %}
                {% for combination in product.combinations %}
                  <tr>
                    <td>{{ combination.attributes|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                    <td>{{ combination.supplier_reference|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                    <td>{{ combination.wholesale_price|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                    <td>{{ combination.reference|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                    <td>{{ combination.ean13|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                    <td>{{ combination.upc|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                    {% if not isAllShopContext and isStockManagementEnabled %}
                      <td>{{ combination.quantity|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                    {% endif %}
                  </tr>
                {% endfor %}
              {% else %}
                <tr>
                  <td>{{ product.combinations|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                  <td>{{ product.supplier_reference|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                  <td>{{ product.wholesale_price|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                  <td>{{ product.reference|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                  <td>{{ product.ean13|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                  <td>{{ product.upc|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                  {% if not isAllShopContext and isStockManagementEnabled %}
                    <td>{{ product.quantity|default('N/A'|trans({}, 'Admin.Global')) }}</td>
                  {% endif %}
                </tr>
            {% endif %}
            </tbody>
          </table>
        </div>
      </div>
    {% endfor %}
    {% if viewableSupplier.supplierProducts is empty %}
      <div class="text-center grid-table-empty">
        <p class="mb-0 mt-2"><i class="material-icons">warning</i></p>
        <p class="mb-2">{{ 'No records found'|trans({}, 'Admin.Global') }}</p>
      </div>
    {% endif %}
  </div>
</div>
